﻿#region Copyrigth and License
/*==============================================================================
 *  Copyright (c) cndotnet.org Corporation.  All rights reserved.
 * ===============================================================================
 * This code and information is provided "as is" without warranty of any kind,
 * either expressed or implied, including but not limited to the implied warranties
 * of merchantability and fitness for a particular purpose.
 * ===============================================================================
 * Licensed under the GNU General Public License (GPL) v2
 * http://www.cndotnet.org/ucenter
 * ==============================================================================*/
#endregion
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace UCenter.ContactService.Email {
    class YahooResover {
        #region Fields

        #endregion

        #region Constructors

        #endregion

        #region Properties

        #endregion

        #region Events

        #endregion

        #region
        public static MailContractCollection Resove(string html) {
            MailContractCollection mc = new MailContractCollection();
            List<string> addressContent = WebOpHelper.ResoveList(html, "<td class=\"contactnumbers\">", "</td>");
            foreach (string address in addressContent) {
                string email = WebOpHelper.Resove(address, "\">", "</a>");
                MailContract m = new MailContract();
                m.Email = email;
                mc.Add(m);
            }
            List<string> list2 = WebOpHelper.ResoveList(html, "<span class=\"contactname\">", "</span>");
            int i = 0;
            foreach (string s in list2) {
                var s1 = WebOpHelper.Resove(s, "\" >", "</a>");
                if (string.IsNullOrEmpty(s1)) {
                    mc[i].Name = mc[i].Email;
                }
                else {
                    mc[i].Name = s1;
                }
                i++;
            }
            return mc;
        }
        #endregion
    }
}
